import axios from 'axios'

const headers = {
  env: 'development'
}
const requestConfig = {
  timeout: 10000,
  baseURL: 'http://127.0.0.1:5000',
  headers
}

const request = axios.create(requestConfig)

// 请求拦截
request.interceptors.request.use(
  request => {
    return request
  },
  error => {
    return Promise.reject(error)
  }
)

// 响应拦截
request.interceptors.response.use(
  response => {
    return response
  },
  error => {
    return Promise.reject(error)
  }
)

export default request